// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   LineChart.java

package org.achartengine.chart;

import android.graphics.*;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.renderer.*;

// Referenced classes of package org.achartengine.chart:
//			XYChart, ScatterChart, PointStyle

public class LineChart extends XYChart
{

	public static final String TYPE = "Line";
	private static final int SHAPE_WIDTH = 30;
	private ScatterChart pointsChart;

	LineChart()
	{
	}

	public LineChart(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
	{
		super(xymultipleseriesdataset, xymultipleseriesrenderer);
		pointsChart = new ScatterChart(xymultipleseriesdataset, xymultipleseriesrenderer);
	}

	protected void setDatasetRenderer(XYMultipleSeriesDataset xymultipleseriesdataset, XYMultipleSeriesRenderer xymultipleseriesrenderer)
	{
		super.setDatasetRenderer(xymultipleseriesdataset, xymultipleseriesrenderer);
		pointsChart = new ScatterChart(xymultipleseriesdataset, xymultipleseriesrenderer);
	}

	public void drawSeries(Canvas canvas, Paint paint, float af[], SimpleSeriesRenderer simpleseriesrenderer, float f, int i)
	{
		int j = af.length;
		XYSeriesRenderer xyseriesrenderer = (XYSeriesRenderer)simpleseriesrenderer;
		float f1 = paint.getStrokeWidth();
		paint.setStrokeWidth(xyseriesrenderer.getLineWidth());
		if (xyseriesrenderer.isFillBelowLine())
		{
			paint.setColor(xyseriesrenderer.getFillBelowLineColor());
			int k = af.length;
			float af1[] = new float[k + 4];
			System.arraycopy(af, 0, af1, 0, j);
			af1[0] = af[0] + 1.0F;
			af1[j] = af1[j - 2];
			af1[j + 1] = f;
			af1[j + 2] = af1[0];
			af1[j + 3] = af1[j + 1];
			paint.setStyle(android.graphics.Paint.Style.FILL);
			drawPath(canvas, af1, paint, true);
		}
		paint.setColor(simpleseriesrenderer.getColor());
		paint.setStyle(android.graphics.Paint.Style.STROKE);
		drawPath(canvas, af, paint, false);
		paint.setStrokeWidth(f1);
	}

	protected RectF[] clickableAreasForPoints(float af[], float f, int i)
	{
		int j = af.length;
		RectF arectf[] = new RectF[j / 2];
		for (int k = 0; k < j; k += 2)
		{
			int l = mRenderer.getSelectableBuffer();
			arectf[k / 2] = new RectF(af[k] - (float)l, af[k + 1] - (float)l, af[k] + (float)l, af[k + 1] + (float)l);
		}

		return arectf;
	}

	public int getLegendShapeWidth(int i)
	{
		return 30;
	}

	public void drawLegendShape(Canvas canvas, SimpleSeriesRenderer simpleseriesrenderer, float f, float f1, int i, Paint paint)
	{
		canvas.drawLine(f, f1, f + 30F, f1, paint);
		if (isRenderPoints(simpleseriesrenderer))
			pointsChart.drawLegendShape(canvas, simpleseriesrenderer, f + 5F, f1, i, paint);
	}

	public boolean isRenderPoints(SimpleSeriesRenderer simpleseriesrenderer)
	{
		return ((XYSeriesRenderer)simpleseriesrenderer).getPointStyle() != PointStyle.POINT;
	}

	public ScatterChart getPointsChart()
	{
		return pointsChart;
	}

	public String getChartType()
	{
		return "Line";
	}
}
